package com.qingzhuge.exception;


import com.qingzhuge.common.HttpCode;

import java.util.Map;

/**
 * @author : zero.xiao
 * @description :数据验证错误
 * @modified :
 */
public class ValidatorException extends BaseException {

    private static final long serialVersionUID = -3100648913329749866L;

    public ValidatorException() {
        super(HttpCode.VALIDATOR_FAILED.message());
    }

    public ValidatorException(Map<String,Object> data) {
        super(data);
    }

    public ValidatorException(String message) {
        super(message);
    }

    public ValidatorException(Throwable ex) {
        super(ex);
    }

    public ValidatorException(String message, java.lang.Exception e) {
        super(message, e);
    }

    public ValidatorException(String message, int code) {
        super(message, code);
    }

    public ValidatorException(String message, Map<String, Object> data, int code) {
        super(message, data, code);
    }

    @Override
    public int getCode() {
        if (super.getCode() != CODE_VAL){
            return super.getCode();
        }
        return HttpCode.VALIDATOR_FAILED.value();
    }
}